<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.fc.control.AdminControl"%>
<%@ page import="com.fc.util.ParamUtil"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>login_do</title>

  </head>
  
  <body>
    <%
	String rand = (String) session.getAttribute("rand");
	String input = request.getParameter("rand");
	String username = request.getParameter("username");
	String password =  request.getParameter("password");
	AdminControl uc = new AdminControl();
	if (uc.isAdmin(username, password)) {
	//System.out.print("aaaa");
	   if(rand.equals(input)) {
			session.setAttribute("username",username); 
			session.setAttribute("password",password);
			response.sendRedirect("../admin/admin.jsp");
		} else {
%>
	<script type="text/javascript">
		alert("用户名或密码错误,请重新输入！");
		window.location.href="login.jsp";
	</script>
<% } } else {
 		if (username != "" || password != "") {
%>
	<script language="javascript">
		alert("用户名或密码错误,请重新输入！");
		window.location.href="login.jsp";
	</script>
<% } else{
%>
	<script language="javascript">
		window.location.href="login.jsp";
	</script>
<%
} }
%>

  </body>
</html>
